//
// Created by benxb on 2022/3/12.
//

#include <nsh_reader.h>
#include <sstream>


NSHReader::NSHReader(const std::string &data_dir) : DataReader(data_dir) {

}

void NSHReader::ReadSweep(std::vector<float> &x_arr, std::vector<float> &y_arr, std::vector<float> &z_arr) {
    // open data file
    data_io_.open(data_files_[next_index], std::ios::binary | std::ios::in | std::ios::out);
    while (!data_io_.eof()) {
        float x, y, z;
        std::string line;
        getline(data_io_, line);
        std::stringstream ss(line);
        ss >> x >> y >> z;
        x_arr.push_back(x);
        y_arr.push_back(y);
        z_arr.push_back(z);
    }
    next_index++;
    data_io_.close();
}
